#页面类
from Day18.Base import Base
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from Day18.shuijvqvd import Toocls
from time import sleep
from ddt import data,unpack,ddt,file_data
@ddt
class Page(Base):
    path = r"C:\Users\HP\Desktop\table.xlsx"
    sheetname = 'Sheet1'
    dy = Toocls(path, sheetname)
    print(dy.getdata())
    #定位器
    search_loc=(By.NAME,'key')

    #点击请登录
    login=(By.CLASS_NAME,'headerLogin')
    #账号
    username=(By.ID,'userName')
    #密码
    password=(By.NAME,'_pwd')
    #点击登录
    dl=(By.XPATH,'//*[@id="save"]')
    #点击确定
    accopt=(By.XPATH,'//*[@id="bindSub"]')
    #页面元素的封装
    @unpack
    @data(*dy.getdata())
    def search(self,username,password):
        #点击请登录
        self.click(self.login)
        sleep(3)
        #输入账号
        self.send_keys(self.username,username)
        sleep(3)
        #输入密码
        self.send_keys(self.password,password)
        sleep(10)
        #点击登录
        self.click(self.dl)
        sleep(3)
        #点击确定
        self.click(self.accopt)
        sleep(3)

    #业务逻辑
    def luoji_jiuxian_01(self):
        self.open_url('https://www.jiuxian.com/')
        self.search()
        sleep(5)